package com.ruoyi.project.ypjxc.service.impl;

import com.ruoyi.project.ypjxc.domain.Supplier;
import com.ruoyi.project.ypjxc.mapper.YpjxcFactoryMapper;
import com.ruoyi.project.ypjxc.mapper.YpjxcSupplierMapper;
import com.ruoyi.project.ypjxc.service.YpjxcFactoryService;
import com.ruoyi.project.ypjxc.service.YpjxcSupplierService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class YpjxcSupplierServiceImpl implements YpjxcSupplierService {
    @Autowired
    private YpjxcSupplierMapper supplierMapper;

    /**
     * 查询供应商信息
     * @param supplier 供应商信息
     * @return
     */
    @Override
    public List<Supplier> selectSupplierList(Supplier supplier) {
        return supplierMapper.selectSupplierList(supplier);
    }

    /**
     * 添加供应商信息
     * @param supplier 供应商信息
     * @return
     */
    @Override
    public int insertSupplier(Supplier supplier) {

        return supplierMapper.insertSupplier(supplier);
    }

    /**
     *
     * 修改供应商信息
     * @param supplier 供应商信息
     * @return
     */
    @Override
    public int updateSupplier(Supplier supplier) {
        return supplierMapper.updateSupplier(supplier);
    }

    /**
     * 根据供应商id查询
     * @param supplierId 供应商ID
     * @return
     */
    @Override
    public Supplier selectSupplierById(Long supplierId) {
        return supplierMapper.selectSupplierById(supplierId);
    }

    /**
     * 批量删除供应商信息
     * @param supplierId 需要删除的供应商ID
     * @return
     */
    @Override
    @Transactional
    public int deleteSupplierByIds(Long[] supplierId) {
        int i = supplierMapper.deleteSupplierByIds(supplierId);
        return i;
    }


}
